﻿/*
    March 2011, Muaz Khan, dtweet
    website homepage
    
    This file is for site's main page
*/

var homeCaller = function ()
{
    var tweetsTable = $( '#tweets' );  // caching purpose
    $.ajax( {
        url: domainName + '/Home/InsertUserTweetsAtPageLoad', // website homepage load
        type: 'POST',
        success: function ( result )
        {
            if ( result.IsSuccess === true )
            {
                dtweet.tweetMessage( result, tweetsTable ); // dtweet.layout.js
            }
            else
            {
                $( '#h2' ).html( 'No public tweet yet!' );
            }
            $( '#div-process' ).hide();
        },
        error: function ()
        {
            tweetsTable.html( 'Sorry, something went wrong. Plese refresh the page.' );
            $( '#div-process' ).hide();
        }
    } ).done( function ()
    {
        dtweet.setMinHeight(); // dtweet.layout.js
        $( '#div-process' ).hide();
    } );
};